<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SSE Example</title>
    <script src="https://cdn.staticfile.org/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
<h1>Server-Sent Events Example</h1>
<div id="events"></div>

<script>
    $(document).ready(function() {
        var source = new EventSource("/chatgptsse");
        source.onmessage = function(e) {
            let data = JSON.parse(e.data);

            $("#events").append("<p>" + data.message + '-' + data. time + "</p>");
        };
    });

</script>
</body>
</html>
